﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace TN_CMS.Domain.Entities
{
    public class News
    {
        public News() {
            NewsGroups = new HashSet<NewsGroup>();
        }

        [Key()]
        [ScaffoldColumn(false)]
        public int Id { get; set; }

        [UIHint("TNText")]
        [Required]
        public string Title { get; set; }

        [UIHint("TNText")]
        public string Keywords { get; set; }

        [UIHint("TNText")]
        public string Summary { get; set; }

        [Required]
        [UIHint("TNCkEditor")]
        public string Content { get; set; }

        [ScaffoldColumn(false)]
        [UIHint("TNDisplayText")]
        [Display(Name = "Total Views")]
        public int TotalViews { get; set; }

        [UIHint("TNDisplayText")]
        [Display(Name = "Created On")]
        [ScaffoldColumn(false)]
        public DateTime CreatedOn { get; set; }

        [ScaffoldColumn(false)]
        public int CreatedBy { get; set; }

        public virtual SysAdmin CreatedByAdmin { get; set; }

        [UIHint("TNDisplayText")]
        [Display(Name = "Updated On")]
        [ScaffoldColumn(false)]
        public DateTime? UpdatedOn { get; set; }

        [ScaffoldColumn(false)]
        public int? UpdatedBy { get; set; }
        public virtual SysAdmin UpdatedByAdmin { get; set; }

        [UIHint("TNCheckBox")]
        [Display(Name = "Is Active")]
        public bool IsActive { get; set; }

        [NotMapped]
        [Display(Name = "Groups")]
        public List<int> LstGroups { get; set; }

        [Display(Name = "Groups")]
        public virtual ICollection<NewsGroup> NewsGroups { get; set; }
    }
}
